﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using StoreHoursDomain.Entity;

namespace WebUI.Models
{
    public class StoreHoursViewModel
    {
        public bool Closed { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public HtmlString DisplayFormat
        {
            get { return new HtmlString(Closed ? "Closed" : StartTime.ToString("hh:mm tt") + "<br />" + EndTime.ToString("hh:mm tt")); }
        }

        public static StoreHoursViewModel GetStoreHoursViewModel(StoreHours storeHours)
        {
            return storeHours != null ? new StoreHoursViewModel { Closed = storeHours.Closed, StartTime = storeHours.StartTime, EndTime = storeHours.EndTime } : new StoreHoursViewModel { Closed = true };
        }
    }
}